
#ifndef __SCP_SEND_CHANNEL_H
#define __SCP_SEND_CHANNEL_H

#include "../aprtools/APRBucketBrigade.h"
#include "../aprtools/APRFuture.h"
#include "SSHChannel.h"

/** Class encapsulating a secure file transfer local->remote through
 * an SSH channel. */
class SCPSendChannel : public SSHChannel
{
   public:
      LIBSSH2_CHANNEL *initialiseSCPSend(const char *remotefile, int64_t remotefilelength, int remoteaccess);
      SCPSendChannel(SSHClient &itclient);
      virtual ~SCPSendChannel();
      int copyFileToRemoteFile(LIBSSH2_CHANNEL *tchannel, const char *remotefile, const char *localfile, int remoteaccess);
      int copyBufferToRemoteFile(LIBSSH2_CHANNEL *tchannel, const char *remotefile, const char *localbuffer, int64_t localbufferlen, int remoteaccess);
      APRFuture<int> *copyFileToRemoteFileFuture(const char *remotefile, const char *localfile, int remoteaccess);
      APRFuture<int> *copyBufferToRemoteFileFuture(const char *remotefile, const char *localbuffer, int64_t localbufferlen, int remoteaccess);
      static void *copyFileToRemoteFileThread(apr_thread_t *tthread, void *args);
      static void *copyBufferToRemoteFileThread(apr_thread_t *tthread, void *args);
   protected:
      /** Enables access to copyBufferToRemoteFile from a thread.
       * 
       * @return Functor to copyBufferToRemoteFileThread. */
      virtual functor getCopyBufferToRemoteFileThread() const { return (functor)(&copyBufferToRemoteFileThread); }
      /** Enables access to copyFileToRemoteFile from a thread.
       * 
       * @return Functor to copyFileToRemoteFileThread. */
      virtual functor getCopyFileToRemoteFileThread() const { return (functor)(&copyFileToRemoteFileThread); }
};

#endif
